package strings;

/**
 * @author LiangMu
 * @version \$Id: P3.java, v 0.1, 2023年01月16日 14:36 LiangMu Exp $$
 */
public class P3 {
    public static void main(String[] args) {
        int i1 = -127, i2 = 128;
        System.out.println(i1 == i2);
    }

    public static boolean areSentencesSimilar(String sentence1, String sentence2) {
        String[] w1 = sentence1.split(" ");
        String[] w2 = sentence2.split(" ");
        int l = 0, r = 0, len1 = w1.length, len2 = w2.length;
        while (l < len1 && l < len2 && w1[l].equals(w2[l])) {
            ++l;
        }
        while (r < len1 && r < len2 && w1[len1 - 1 - r].equals(w2[len2 - 1 - r])) {
            ++r;
        }
        return l + r == Integer.min(len2, len1);
    }
}
